from django.db import models


class Tasks(models.Model):
    id = models.CharField('ID', primary_key=True, max_length=100)
    subjects = models.CharField('任务标题', max_length=100, null=True, blank=True)
    sender = models.EmailField('发起人', null=True, blank=True)
    status = models.CharField('状态', max_length=50, null=True, blank=True)
    operator = models.CharField('操作员', max_length=20, null=True, blank=True)
    auditor = models.CharField('审核员', max_length=20, null=True, blank=True)
    create_time = models.DateTimeField('创建时间', auto_now_add=True, null=True, blank=True)
    update_time = models.DateTimeField('更新时间', null=True, blank=True)
    svn_address = models.CharField('svn地址', max_length=500, null=True, blank=True)
    task_id = models.CharField('任务ID', max_length=100, null=True, blank=True)
    task_status = models.CharField('任务执行状态', max_length=20, null=True, blank=True)
    task_result = models.CharField('执行结果', max_length=500, null=True, blank=True)
    comment = models.TextField('备注', default='', blank=True)

    def __str__(self):
        return self.id

    class Meta:
        ordering = ["-create_time"]
        verbose_name = '任务列表'
        verbose_name_plural = verbose_name
